
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.media.jai.*;
import javax.media.jai.widget.ScrollingImagePanel;

import java.awt.*;
import java.awt.image.*;


public class carregarImagem {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		int largura = 256;
		int altura = 256;
		BufferedImage image = new BufferedImage(largura, altura, BufferedImage.TYPE_INT_BGR);
		WritableRaster raster = image.getRaster();
		
		int[] cor1 = new int[] {255,0,0};
		int[] cor2 = new int[] {0,0,255};
		int cont=0;
		
		for (int h=0;h<altura;h++)
			for (int w=0;w<largura;w++)
			{
				if ((((w/32) + (h/32)) % 2) == 0) raster.setPixel(w, h, cor1);
				else raster.setPixel(w, h, cor2);				
			}
		
		ImageIO.write(image, "PNG", new File("saida.png"));
		
	
		
		
	}

}
